<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <%@ include file="/WEB-INF/views/include/head.jsp"%> 
        <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
        <script type="text/javascript">
        $(document).ready(function(){
            
           });
           //保存方法
        var saveForm={
                t:null,
                save:function(t){
                    $(t).attr("disabled",true);
                    this.t=t;
                          // 验证
                          $("#inputForm").validate({
                              submitHandler: function() {
                                  // 格式化，去除逗号
                                  formUnFormat($("#inputForm"));
                                  // 从表单中获取值
                                  var params = $("#inputForm").serialize();
                                     // 调用后台方法
                                     $.post("${ctx}/material/mywarehouse/saveInventory",params,function(result){
                                          // 提示信息
                                          tipParent(result.message);
                                          // 返回状态
                                          if(result.statusCode==STATUSCODEOK){
                                              $(saveForm.t).attr("disabled",false);
                                              // 刷新页面
                                              window.parent.frames[0].location.reload();
                                              // 关闭页面
                                              closeWin(); 
                                            }else{
                                                $(saveForm.t).attr("disabled",false);
                                            }
                                       },'json'); 
                                  },
                                  fail: function(element,e) {  
                                      $(saveForm.t).attr("disabled",false);
                                  }
                          });
                          // 添加表单
                          $("#inputForm").submit(); 
                        }
                       }
        </script>
    </head>
    <body>
        <div class="myshop clearfix">
            <!-- 物料库存 -->
            <p class="myshoptop fl"><spring:message code="myWarehouseInventoryMaterial"/></p>
            <div class="fr">
                <div class="topBtnClose" onclick="closeWin()">
                    <img src="${ctxStatic}/images/btn-close.png">
                </div>
            </div>
        </div>
        <form id="inputForm" method="post">
        <input type="hidden"  name="id" value="${material.id}"/>
        <input type="hidden"  name="inventoryMaterial.version" value="${material.inventoryMaterial.version}"/>
        <input type="hidden"  name="inventoryMaterial.materialId" value="${material.inventoryMaterial.materialId}"/>
        <input type="hidden"  name="inventoryMaterial.inventoryMaterialId" value="${material.inventoryMaterial.inventoryMaterialId}"/>
            <div class="middle myshop_middle">
                <div class="clearfix" style="height:170px;">
                    <div class="ch fl">
                        <div class="data clearfix">
                            <!-- 物料名称 -->
                            <p class="data_id"><spring:message code="myWarehouse_name_edit"/></p>
                            <p class="rtname fl" data-toggle="tooltip" title="${material.materialNameCn}">${material.materialNameCn}</p>
                        </div>
                        <div class="data clearfix">
                            <!-- 物料编号 -->
                            <p class="data_id"><spring:message code="myWarehouse_code_edit"/></p>
                            <p class="rtname fl">${material.materialCode}</p>
                        </div>
                        <div class="clearfix">
                            <!-- 适用季节 -->
                            <p class="data_id"><spring:message code="myWarehouse_season_edit"/></p>
                            <p class="rtname fl">${fns:getDictName(material.materialSeason)}</p>
                        </div>
                    </div>
                    <div class="ch fr">
                        <div class="data clearfix">
                            <!-- 物料库存 -->
                            <p class="data_id" style=""><spring:message code="myWarehouseInventoryMaterial_show"/></p>
                            <input type="tel" class="form-control" style="width: 200px;" name="inventoryMaterial.materialQuantity" value="<fmt:formatNumber value="${material.inventoryMaterial.materialQuantity}" pattern="#,##0.00#"/> " onblur="formatNumber(this)" onfocus="unFormat(this)" data-rule-integerDecimalmax="7.3" data-msg-integerDecimalmax="<spring:message code="myWarehouse_pleaseInputInventoryMaterial"/>" >
                            ${fns:getDictName(material.materialUnitCd)}
                        </div>
                        <div class=" clearfix">
                            <!-- 备注 -->
                            <p class="data_id"><spring:message code="myWarehouse_remarks_edit"/></p>
                            <p class="rtname fl" data-toggle="tooltip" title="${material.remarks}">${material.remarks}</p>
                        </div>
                    </div>
                </div>
                <div class="twobtn" style="margin-top:80px;">
                    <div class="onebtn clearfix">
                        <shiro:hasPermission name="material:mywarehouse:edit">
                            <button type="button" class="btn save fl" onclick="saveForm.save(this)"><spring:message code="myWarehouse_save"/></button>
                        </shiro:hasPermission>
                    </div>
                </div>
            </div>
        </form>
        <script>
            var windowH = window.innerHeight
                    ||document.documentElement.clientHeight
                    ||document.body.clientHeight
            $('.middle').css('height',windowH - 40);
        </script>
    </body>
</html>
